package com.marry.core.exception;



import com.marry.core.result.WrapMapper;
import com.marry.core.result.Wrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


/**
 * 全局处理的异常类，其他模块需要继承他
 */
public class GobalExceptionHandler {
    private final Log logger = LogFactory.getLog(getClass());



    public Wrapper handleCustomException(BusinessException e) {
        logger.error(e.getMessage());
        return WrapMapper.error(e.getCode(),e.getMessage());
    }


    public Wrapper handleCustomException(Exception e) {
        logger.error(e.getMessage());
        return WrapMapper.error(500,e.getMessage());
    }

}